package com.lineage.data.item_etcitem;

import com.lineage.data.executor.ItemExecutor;
import com.lineage.server.model.Instance.L1ItemInstance;
import com.lineage.server.model.Instance.L1PcInstance;
import com.lineage.server.serverpackets.S_NPCTalkReturn;
import com.lineage.server.serverpackets.S_SystemMessage;
import com.lineage.server.serverpackets.ServerBasePacket;

public class CardBook extends ItemExecutor {
  private static CardBook _instance;
  
  public static ItemExecutor get() {
    return new CardBook();
  }
  
  public static CardBook getInstance() {
    if (_instance == null)
      _instance = new CardBook(); 
    return _instance;
  }
  
  public void execute(int[] data, L1PcInstance pc, L1ItemInstance item) {
    if (item == null)
      return; 
    if (pc == null)
      return; 
    if (pc.isPrivateShop()) {
      pc.sendPackets((ServerBasePacket)new S_SystemMessage("摆摊状态下 无法使用"));
      return;
    } 
    if (pc.isFishing()) {
      pc.sendPackets((ServerBasePacket)new S_SystemMessage("钓鱼状态下 无法使用"));
      return;
    } 
    pc.setCarId(-1);
    pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(pc.getId(), "card_01"));
  }
}
